<?php
include('db.php');
$db = getDb();

$content=file_get_contents("../view/account.html");
$_EMAIL_="_EMAIL_";
$_EMAIL_content="";

$_EMAILPASSWD_="_EMAILPASSWD_";
$_EMAILPASSWD_content="";

 	
 
 if($_GET["email"] || $_GET["emailpasswd"])
 { 	
 	$sqlCommand="UPDATE access SET email='" . $_GET["email"] ."',emailpasswd='".$_GET["emailpasswd"]."'";
 	$result = $db->Execute($sqlCommand);
 	
 	if ($result === false)
 		die($sqlCommand);
 	echo "<b>saved</b><br/>";
 }
 
 
 $sqlCommand="SELECT email,emailpasswd FROM access";
 $result = $db->Execute($sqlCommand);
 
 if ($result === false)
 	die($sqlCommand);

 $_EMAIL_content = $result->fields[0];
 $_EMAILPASSWD_content = $result->fields[1];
 

 $content = str_replace($_EMAIL_ , $_EMAIL_content, $content);
 $content = str_replace($_EMAILPASSWD_ , $_EMAILPASSWD_content, $content);
 
 
 
 // Display page
 echo $content;
 
?>
